home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / progutil / stdwin.zoo / vt / vtputs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-10-17  |  1.2 KB  |  58 lines

  1. /* A simpler output function, which does not know about escapes */
  2. /* $Header: vtputs.c,v 1.3 88/06/03 14:46:02 guido Exp $ */
  3.  
  4. #include "vtimpl.h"
  5.  
  6. void
  7. vtputs(vt, text)
  8.     VT *vt;
  9.     char *text;
  10. {
  11.     while (*text != EOS) {
  12.         if (PRINTABLE(*text)) {
  13.             register char *end= text;
  14.             while (PRINTABLE(*++text))
  15.                 ;
  16.             vtputstring(vt, text, (int)  (end-text));
  17.             text= end;
  18.         }
  19.         else switch (*text++) {
  20.         
  21.         case BEL:    /* Make some noise */
  22.             wfleep();
  23.             break;
  24.         
  25.         case BS:    /* Move 1 left */
  26.             /* Rely on vtsetcursor's clipping */
  27.             vtsetcursor(vt, vt->cur_row, vt->cur_col - 1);
  28.             /* Don't erase --
  29.                that's part of intelligent echoing */
  30.             break;
  31.         
  32.         case TAB:    /* Move to next tab stop */
  33.             /* Rely on vtsetcursor's clipping */
  34.             vtsetcursor(vt, vt->cur_row,
  35.                 (vt->cur_col & ~7) + 8);
  36.             /* Normalize cursor (may cause scroll!) */
  37.             vtputstring(vt, "", 0);
  38.             break;
  39.         
  40.         case LF:    /* Move cursor down in same column */
  41.             vtsetcursor(vt, vt->cur_row + 1, vt->cur_col);
  42.             /* Normalize cursor (may cause scroll!) */
  43.             vtputstring(vt, "", 0);
  44.             break;
  45.         
  46.         case FF:    /* Start over */
  47.             vtreset(vt);
  48.             break;
  49.         
  50.         case CR:    /* Back to col 0 on same line */
  51.             vtsetcursor(vt, vt->cur_row, 0);
  52.             break;
  53.         
  54.         }
  55.     }
  56.     vtsync(vt);
  57. }
  58.